<template>
  <div>
    <table
      class="w-100"
      style="height: 60vh"
      v-loading="loading"
      v-if="!report.report_month_id && isViewMode"
    >
      <tr class="text-center">
        <td>暂未新增该月报表</td>
      </tr>
    </table>
    <div id="table-print" v-else>
      <table class="table report-table" v-loading="loading">
        <colgroup>
          <col width="4.3%" />
          <col width="6.5%" />
          <col width="7.2%" />
          <col width="8.9%" />
          <col width="7.1%" />
          <col width="8.5%" />
          <col width="7.3%" />
          <col width="8.1%" />
          <col width="8.5%" />
          <col width="7.6%" />
          <col width="9.4%" />
          <col width="9%" />
          <col width="7.6%" />
        </colgroup>
        <tbody>
          <tr>
            <td colspan="13" rowspan="2" style="border: none">
              <h3 class="report-title">
                {{ `省级农担公司业务发展情况统计月报（${reportMonth}月）` }}
              </h3>
            </td>
          </tr>
          <tr></tr>
          <el-button
            :icon="`el-icon-${isEdit ? 'close' : 'edit'}`"
            v-if="buttonEdit"
            @click="handleEdit"
            class="edit-button"
          >
            {{ isEdit ? '关闭' : '编辑' }}
          </el-button>

          <tr>
            <td
              colspan="2"
              rowspan="2"
              class="font-weight-bold report-gray bt-double bl-double bb-double"
            >
              省级农担公司名称
            </td>
            <td colspan="2" rowspan="2" class="font-weight-bold report-text-lg bt-double bb-double">
              {{ org.orgName }}
            </td>
            <td colspan="2" class="font-weight-bold report-gray bt-double">
              是否由省(市)财政部门直接履行出资人职责
            </td>
            <td class="font-weight-bold bt-double">是</td>
            <td class="font-weight-bold report-gray bt-double">上级主管单位及处室</td>
            <td colspan="2" class="font-weight-bold bt-double">农业处</td>
            <td rowspan="2" class="font-weight-bold report-gray bt-double bb-double">
              填报人员姓名及联系方式
            </td>
            <td colspan="2" rowspan="2" class="bt-double br-double bb-double">
              <span v-if="isViewMode">
                <div>{{ report.dept_name }}</div>
                {{ report.submit_person_name }}：{{ report.phone_number }}
              </span>
              <span v-else>
                <div>{{ user.deptName }}</div>
                {{ user.realName }}：{{ user.phoneNumber }}
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray bb-double">是否有母公司</td>
            <td class="font-weight-bold bb-double">否</td>
            <td class="font-weight-bold report-gray bb-double">母公司名称</td>
            <td colspan="2" class="font-weight-bold bb-double"></td>
          </tr>
          <tr>
            <td rowspan="14" class="font-weight-bold report-gray report-text-lg bl-double">
              资产负债情况
            </td>
            <td colspan="2" class="font-weight-bold report-gray text-left">注册资本金（亿元）</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.register_funds }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.register_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="注册资本金"
                ></el-input>
              </span>
            </td>
            <td rowspan="17" class="font-weight-bold report-text-lg bb-double report-gray">
              业务开展及机构人员情况
            </td>
            <td class="font-weight-bold report-gray"></td>
            <td colspan="2" class="font-weight-bold report-gray">金额(万元)</td>
            <td class="font-weight-bold report-gray">项目数</td>
            <td rowspan="17" class="font-weight-bold report-gray report-text-lg bb-double">
              风险情况
            </td>
            <td class="font-weight-bold report-gray"></td>
            <td class="font-weight-bold report-gray">金额(万元)</td>
            <td class="font-weight-bold report-gray br-double">项目数</td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中:中央支持粮食适度规模经营资金</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.foods_funds }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.foods_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="中央支持粮食适度规模经营资金"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">在保项目</td>
            <td colspan="2" class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.in_gua_funds }}
            </td>
            <td class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.in_gua_total }}
            </td>
            <td class="font-weight-bold report-gray text-left">本月新增代偿项目</td>
            <td class="font-weight-bold report-gray">
              <span v-if="isViewMode || isEdit">{{ riskData.current_month_comps_funds }}</span>
              <span v-else-if="+reportMonth === 1">
                {{ reportDetail.policyTotal.comps_funds_current_year }}
              </span>
              <span v-else>
                {{
                  sub(
                    reportDetail.policyTotal.comps_funds_current_year,
                    policyCount.comps_funds_current_year
                  )
                }}
              </span>
            </td>
            <td class="font-weight-bold report-gray br-double">
              <span v-if="isViewMode || isEdit">{{ riskData.current_month_comps_total }}</span>
              <span v-else-if="+reportMonth === 1">
                {{ reportDetail.policyTotal.comps_total_current_year }}
              </span>
              <span v-else>
                {{
                  sub(
                    reportDetail.policyTotal.comps_total_current_year,
                    policyCount.comps_total_current_year
                  )
                }}
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中: 财政直接出资资金</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.final_funds }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.final_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="财政直接出资资金"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">在保放大倍数</td>
            <td colspan="2" class="font-weight-bold report-gray">
              <span v-if="isViewMode">{{ report.in_gua_multiple }}</span>
              <span v-else>{{ inGuaMultiple }}</span>
            </td>
            <td class="font-weight-bold report-gray">/</td>
            <td class="font-weight-bold report-gray text-left">本年累计代偿项目</td>
            <td class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.comps_funds_current_year }}
            </td>
            <td class="font-weight-bold report-gray br-double">
              {{ reportDetail.policyTotal.comps_total_current_year }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">上年末净资产（元）</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.last_assets }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.last_assets"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="上年末净资产（元）"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">本年新增项目</td>
            <td colspan="2" class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.in_gua_funds_current_year }}
            </td>
            <td class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.in_gua_total_current_year }}
            </td>
            <td class="font-weight-bold report-gray text-left">本年累计追偿项目</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.current_year_recover_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.current_year_recover_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="本年累计追偿金额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.current_year_recover_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.current_year_recover_total"
                  v-input-number="{ min: 0 }"
                  placeholder="本年累计追偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">本期期末净资产（元）</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.current_assets }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.current_assets"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="本期期末净资产（元）"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">新增放大倍数</td>
            <td colspan="2" class="font-weight-bold report-gray">
              <span v-if="isViewMode">{{ report.new_gua_multiple }}</span>
              <span v-else>{{ newGuaMultiple }}</span>
            </td>
            <td class="font-weight-bold report-gray">/</td>
            <td class="font-weight-bold report-gray text-left">自成立以来累计代偿项目</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.comps_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.comps_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="自成立以来累计代偿金额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.comps_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.comps_total"
                  v-input-number="{ min: 0 }"
                  placeholder="自成立以来累计代偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">
              对国家农担公司股权投资（元）
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.stock_contry }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.stock_contry"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="对国家农担公司股权投资（元）"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">本年累计解保项目</td>
            <td colspan="2" class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.un_gua_funds_current_year }}
            </td>
            <td class="font-weight-bold report-gray">
              {{ reportDetail.policyTotal.un_gua_total_current_year }}
            </td>
            <td class="font-weight-bold report-gray text-left">自成立以来累计追偿项目</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.recover_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.recover_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="自成立以来累计追偿金额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.recover_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.recover_total"
                  v-input-number="{ min: 0 }"
                  placeholder="自成立以来累计追偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">风险准备(万元)</td>
            <td class="font-weight-bold report-gray">{{ riskFundsTotal }}</td>
            <td class="font-weight-bold report-gray text-left">公司人员</td>
            <td class="font-weight-bold report-gray">专职人员数</td>
            <td class="font-weight-bold report-gray">兼职人员数</td>
            <td class="font-weight-bold report-gray">公司专职人员总数</td>
            <td class="font-weight-bold report-gray text-left">自成立以来累计解保项目</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.un_gua_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.un_gua_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="自成立以来累计解保金额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.un_gua_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.un_gua_total"
                  v-input-number="{ min: 0 }"
                  placeholder="自成立以来累计解保项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">期末未到期责任准备金余额</td>
            <td class="report-gray font-weight-bold">
              <span v-if="isViewMode">{{ assetsData.end_term_ready }}</span>
              <span v-else>{{ Math.round((assetsData.gua_fee_income / 2) * 100) / 100 }}</span>
            </td>
            <td class="report-gray text-left">公司本部</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.full_time_person }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.full_time_person"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="专职"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.part_time_person }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.part_time_person"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="兼职"
                ></el-input>
              </span>
            </td>
            <td rowspan="2" class="font-weight-bold report-gray">{{ comperPerson }}</td>
            <td class="font-weight-bold report-gray text-left">尚有代偿余额的项目</td>
            <td class="font-weight-bold report-gray">
              {{ sub(riskData.comps_funds, riskData.recover_funds) }}
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.comps_left_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.comps_left_total"
                  v-input-number="{ min: 0 }"
                  placeholder="尚有代偿余额的项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">担保赔偿准备金余额</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.gua_comps_ready }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.gua_comps_ready"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="担保赔偿准备金余额"
                ></el-input>
              </span>
            </td>
            <td class="report-gray text-left">分支机构</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.sub_full_time_person }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.sub_full_time_person"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="专职"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.sub_part_time_person }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.sub_part_time_person"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="兼职"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">逾期未代偿项目</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.overdue_no_comps_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.overdue_no_comps_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="逾期未代偿金额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.overdue_no_comps_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.overdue_no_comps_total"
                  v-input-number="{ min: 0 }"
                  placeholder="逾期未代偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">一般责任准备余额</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.normal_ready }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.normal_ready"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="一般责任准备余额"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">分支机构类型</td>
            <td class="font-weight-bold report-gray">有专职人员机构数</td>
            <td class="font-weight-bold report-gray">无专职人员机构数</td>
            <td class="font-weight-bold report-gray">有专职人员机构总数</td>
            <td rowspan="2" class="font-weight-bold report-gray text-left">
              其中:本月新增逾期未代偿项目
            </td>
            <td rowspan="2" class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.month_overdue_no_comps_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.month_overdue_no_comps_funds"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="本月新增逾期未代偿金额"
                ></el-input>
              </span>
            </td>
            <td rowspan="2" class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.month_overdue_no_comps_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.month_overdue_no_comps_total"
                  v-input-number="{ min: 0 }"
                  placeholder="本月新增逾期未代偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">收入(万元)</td>
            <td class="font-weight-bold report-gray">{{ inFundsTotal }}</td>
            <td class="report-gray text-left">县级以上机构</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.full_time_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.full_time_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.no_full_time_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.no_full_time_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
            <td
              rowspan="2"
              :class="typeof haveFullAgency === 'number' ? '' : 'text-danger'"
              class="font-weight-bold report-gray"
            >
              {{ haveFullAgency }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">担保费收入</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.gua_fee_income }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.gua_fee_income"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="担保费收入"
                ></el-input>
              </span>
            </td>
            <td class="report-gray text-left">县级及以下机构</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.bel_full_time_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.bel_full_time_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.bel_no_full_time_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.bel_no_full_time_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
            <td rowspan="2" class="font-weight-bold report-gray text-left">
              其中:期末在保且逾期3个月以上未代偿项目
            </td>
            <td rowspan="2" class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.in_gua_onverdue_funds }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.in_gua_onverdue_funds"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="期末在保且逾期3个月以上未代偿金额"
                ></el-input>
              </span>
            </td>
            <td rowspan="2" class="font-weight-bold br-double" :class="tdClass">
              <span v-if="isViewMode">{{ riskData.in_gua_onverdue_total }}</span>
              <span v-else>
                <el-input
                  v-model="riskData.in_gua_onverdue_total"
                  v-input-number="{ min: 0 }"
                  placeholder="期末在保且逾期3个月以上未代偿项目"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">资本金投资收益</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.capital_invest_income }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.capital_invest_income"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="资本金投资收益"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray text-left">分支机构类型</td>
            <td class="font-weight-bold report-gray">有专职人员机构数</td>
            <td class="font-weight-bold report-gray">无专职人员机构数</td>
            <td class="font-weight-bold report-gray">有专职人员机构总数</td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其他收入</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ assetsData.other_income }}</span>
              <span v-else>
                <el-input
                  v-model="assetsData.other_income"
                  v-input-number="{ min: 0, fixed: 2 }"
                  placeholder="其他收入"
                ></el-input>
              </span>
            </td>
            <td class="report-gray text-left">分公司</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.branch_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.branch_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.branch_no_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.branch_no_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
            <td
              rowspan="4"
              :class="typeof ishaveFullAgency === 'number' ? '' : 'text-danger'"
              class="font-weight-bold report-gray bb-double"
            >
              {{ ishaveFullAgency }}
            </td>
            <td class="font-weight-bold report-gray">本年代偿率</td>
            <td class="font-weight-bold report-gray">考虑追偿的本年代偿率</td>
            <td class="font-weight-bold report-gray br-double">累计代偿率</td>
          </tr>
          <tr>
            <td
              rowspan="3"
              class="font-weight-bold report-gray report-text-lg text-left bl-double bb-double"
            >
              融资成本
            </td>
            <td colspan="2" class="font-weight-bold report-gray text-left">平均担保费率（%）</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ report.avg_gua_rate }}</span>
              <span v-else>
                <el-input
                  v-model="report.avg_gua_rate"
                  v-input-number="{ min: 0, max: 100, fixed: 2 }"
                  placeholder="平均担保费率"
                ></el-input>
              </span>
            </td>
            <td class="report-gray text-left">子公司</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.sub_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.sub_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.sub_no_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.sub_no_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold report-gray">{{ compsRate }}%</td>
            <td class="font-weight-bold report-gray">{{ recoveryRate }}%</td>
            <td class="font-weight-bold report-gray br-double">{{ compsTotalRate }}%</td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">平均贷款利率（%）</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ report.avg_loan_rate }}</span>
              <span v-else>
                <el-input
                  v-model="report.avg_loan_rate"
                  v-input-number="{ min: 0, max: 100, fixed: 2 }"
                  placeholder="平均贷款利率"
                ></el-input>
              </span>
            </td>
            <td class="report-gray text-left">办事处</td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.office_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.office_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.office_no_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.office_no_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
            <td rowspan="2" class="font-weight-bold report-gray text-left bb-double">
              逾期3个月以上未代偿比率
            </td>
            <td rowspan="2" class="font-weight-bold report-gray bb-double">
              {{ recoveryMonthRate }}%
            </td>
            <td rowspan="2" class="font-weight-bold report-gray br-double bb-double">/</td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left bb-double">
              综合融资成本（%）
            </td>
            <td class="font-weight-bold report-gray bb-double">{{ rateTotal }}%</td>
            <td class="report-gray text-left bb-double">其他机构</td>
            <td class="font-weight-bold bb-double" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.other_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.other_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="有专职人员"
                ></el-input>
              </span>
            </td>
            <td class="font-weight-bold bb-double" :class="tdClass">
              <span v-if="isViewMode">{{ orgUserData.other_no_full_agency }}</span>
              <span v-else>
                <el-input
                  v-model="orgUserData.other_no_full_agency"
                  v-input-number="{ min: 0, fixed: 0 }"
                  placeholder="无专职人员"
                ></el-input>
              </span>
            </td>
          </tr>
          <tr>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
            <td class="bx-none"></td>
          </tr>
          <tr class="font-weight-bold report-gray report-text-lg">
            <td colspan="3" class="bt-double bl-double"></td>
            <td class="bt-double">
              在保余额
              <br />
              （万元）
            </td>
            <td class="bt-double">在保项目数</td>
            <td class="bt-double">
              本年新增担保金额
              <br />
              （万元）
            </td>
            <td class="bt-double">本年新增项目数</td>
            <td class="bt-double">
              本年累计解保金额
              <br />
              （万元）
            </td>
            <td class="bt-double">本年累计解保项目数</td>
            <td class="bt-double">
              本年累计代偿金额
              <br />
              （万元）
            </td>
            <td class="bt-double">
              本年累计代偿
              <br />
              项目数
            </td>
            <td class="bt-double">
              本月新增担保金额
              <br />
              （万元）
            </td>
            <td class="bt-double br-double">本月新增项目数</td>
          </tr>
          <tr class="font-weight-bold report-gray">
            <td colspan="3" class="bl-double">数据校验</td>
            <td :class="validatorAll.in_gua_funds ? '' : 'text-danger'">
              {{ validatorAll.in_gua_funds ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.in_gua_total ? '' : 'text-danger'">
              {{ validatorAll.in_gua_total ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.in_gua_funds_current_year ? '' : 'text-danger'">
              {{ validatorAll.in_gua_funds_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.in_gua_total_current_year ? '' : 'text-danger'">
              {{ validatorAll.in_gua_total_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.un_gua_funds_current_year ? '' : 'text-danger'">
              {{ validatorAll.un_gua_funds_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.un_gua_total_current_year ? '' : 'text-danger'">
              {{ validatorAll.un_gua_total_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.comps_funds_current_year ? '' : 'text-danger'">
              {{ validatorAll.comps_funds_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.comps_total_current_year ? '' : 'text-danger'">
              {{ validatorAll.comps_total_current_year ? '校验通过' : '校验失败' }}
            </td>
            <td :class="validatorAll.in_gua_funds_current_month ? '' : 'text-danger'">
              {{ validatorAll.in_gua_funds_current_month ? '校验通过' : '校验失败' }}
            </td>
            <td
              :class="validatorAll.in_gua_total_current_month ? '' : 'text-danger'"
              class="br-double"
            >
              {{ validatorAll.in_gua_total_current_month ? '校验通过' : '校验失败' }}
            </td>
          </tr>
          <tr>
            <td colspan="3" class="font-weight-bold report-gray bl-double">按政策性划分合计</td>
            <td class="report-gray">{{ reportDetail.policyTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.in_gua_total }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.in_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.in_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.un_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.un_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.comps_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.comps_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyTotal.in_gua_funds_current_month }}</td>
            <td class="report-gray br-double">
              {{ reportDetail.policyTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="12" class="font-weight-bold report-gray bl-double">按政策性划分</td>
            <td colspan="2" class="font-weight-bold report-gray text-left">
              政策性业务-(10-300万元)
            </td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.in_gua_total }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.in_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.in_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.un_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.un_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.comps_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.policyBusTotal.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policyBusTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policyBusTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">
              其中：1.本年新增当年解保且实际担保期限6个月以上的政策性业务
            </td>
            <td class="report-gray">-</td>
            <td class="report-gray">-</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td>0</td>
            <td class="report-gray">0</td>
            <td class="report-gray br-double">0</td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中：2.其他政策性业务</td>
            <td>{{ reportDetail.policyBusTotal.in_gua_funds }}</td>
            <td>{{ reportDetail.policyBusTotal.in_gua_total }}</td>
            <td>{{ reportDetail.policyBusTotal.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policyBusTotal.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policyBusTotal.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policyBusTotal.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policyBusTotal.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policyBusTotal.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policyBusTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policyBusTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">
              政策性业务-(生猪养殖300-1000万元)
            </td>
            <td class="report-gray">{{ reportDetail.policyBus1000Total.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.policyBus1000Total.in_gua_total }}</td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.in_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.in_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.un_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.un_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.comps_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.comps_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyBus1000Total.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policyBus1000Total.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">
              其中：1.本年新增当年解保且实际担保期限6个月以上的政策性业务
            </td>
            <td>{{ reportDetail.policy_bus_1000_cur.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.in_gua_total }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_cur.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_bus_1000_cur.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_bus_1000_cur.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中：2.其他</td>
            <td>{{ reportDetail.policy_bus_1000_other.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.in_gua_total }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_bus_1000_other.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_bus_1000_other.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_bus_1000_other.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">政策外“双控”业务</td>
            <td class="report-gray">{{ reportDetail.policyControlTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.policyControlTotal.in_gua_total }}</td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.in_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.in_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.un_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.un_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.comps_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.comps_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policyControlTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中：1.10万元以下</td>
            <td>{{ reportDetail.policy_control_10.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_control_10.in_gua_total }}</td>
            <td>{{ reportDetail.policy_control_10.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_10.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_10.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_10.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_10.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_10.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_control_10.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_control_10.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">
              其中：2.300-1000万元
              <br />
              (不含生猪养殖)
            </td>
            <td>{{ reportDetail.policy_control_1000.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_control_1000.in_gua_total }}</td>
            <td>{{ reportDetail.policy_control_1000.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_1000.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_1000.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_1000.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_1000.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_1000.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_control_1000.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_control_1000.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="font-weight-bold report-gray text-left">“双控”外业务</td>
            <td class="report-gray">{{ reportDetail.policyControlExTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.policyControlExTotal.in_gua_total }}</td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.in_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.in_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.un_gua_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.un_gua_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.comps_funds_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.comps_total_current_year }}
            </td>
            <td class="report-gray">
              {{ reportDetail.policyControlExTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policyControlExTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中：1.1000万元以上</td>
            <td>{{ reportDetail.policy_control_ex_1000.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.in_gua_total }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_1000.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_control_ex_1000.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_control_ex_1000.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray text-left">其中：2.非农项目</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_total }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_control_ex_other.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_control_ex_other.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="3" class="font-weight-bold report-gray report-text-lg bl-double">
              按行业划分合计
            </td>
            <td class="report-gray">{{ reportDetail.indTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.in_gua_total }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.in_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.in_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.un_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.un_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.comps_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.indTotal.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.indTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.indTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="12" class="font-weight-bold report-gray bl-double">按行业划分</td>
            <td colspan="2" class="report-gray">非农项目</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_funds }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_total }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.comps_funds_current_year }}</td>
            <td>{{ reportDetail.policy_control_ex_other.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.policy_control_ex_other.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.policy_control_ex_other.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="2" class="report-gray">农林业生产</td>
            <td class="report-gray">粮食种植</td>
            <td>{{ reportDetail.ind_foods.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_foods.in_gua_total }}</td>
            <td>{{ reportDetail.ind_foods.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_foods.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_foods.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_foods.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_foods.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_foods.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_foods.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_foods.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td class="report-gray">重要特色农产品种植</td>
            <td>{{ reportDetail.ind_features.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_features.in_gua_total }}</td>
            <td>{{ reportDetail.ind_features.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_features.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_features.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_features.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_features.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_features.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_features.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_features.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="2" class="report-gray">畜牧业生产</td>
            <td class="report-gray">生猪养殖</td>
            <td>{{ reportDetail.ind_pig.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_pig.in_gua_total }}</td>
            <td>{{ reportDetail.ind_pig.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_pig.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_pig.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_pig.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_pig.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_pig.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_pig.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_pig.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td class="report-gray">其他畜牧业</td>
            <td>{{ reportDetail.ind_animal_other.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_animal_other.in_gua_total }}</td>
            <td>{{ reportDetail.ind_animal_other.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_animal_other.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_animal_other.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_animal_other.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_animal_other.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_animal_other.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_animal_other.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_animal_other.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">渔业生产</td>
            <td>{{ reportDetail.ind_fish.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_fish.in_gua_total }}</td>
            <td>{{ reportDetail.ind_fish.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_fish.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_fish.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_fish.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_fish.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_fish.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_fish.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_fish.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农田建设</td>
            <td>{{ reportDetail.ind_farmland.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_farmland.in_gua_total }}</td>
            <td>{{ reportDetail.ind_farmland.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_farmland.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_farmland.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_farmland.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_farmland.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_farmland.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_farmland.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_farmland.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农资、农机、农技等农业社会化服务</td>
            <td>{{ reportDetail.ind_service.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_service.in_gua_total }}</td>
            <td>{{ reportDetail.ind_service.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_service.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_service.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_service.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_service.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_service.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_service.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_service.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">
              农产品流通
              <br />
              (含农产品收购、仓储保鲜、销售等)
            </td>
            <td>{{ reportDetail.ind_circulation.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_circulation.in_gua_total }}</td>
            <td>{{ reportDetail.ind_circulation.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_circulation.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_circulation.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_circulation.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_circulation.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_circulation.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_circulation.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_circulation.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农产品初加工</td>
            <td>{{ reportDetail.ind_process.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_process.in_gua_total }}</td>
            <td>{{ reportDetail.ind_process.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_process.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_process.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_process.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_process.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_process.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_process.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_process.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农业新业态</td>
            <td>{{ reportDetail.ind_new_forms.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_new_forms.in_gua_total }}</td>
            <td>{{ reportDetail.ind_new_forms.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_new_forms.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_new_forms.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_new_forms.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_new_forms.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_new_forms.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_new_forms.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_new_forms.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">
              其他农业项目
              <br />
              （请在备注中注明具体行业）
            </td>
            <td>{{ reportDetail.ind_other.in_gua_funds }}</td>
            <td>{{ reportDetail.ind_other.in_gua_total }}</td>
            <td>{{ reportDetail.ind_other.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_other.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_other.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.ind_other.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.ind_other.comps_funds_current_year }}</td>
            <td>{{ reportDetail.ind_other.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.ind_other.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.ind_other.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="3" class="font-weight-bold report-gray report-text-lg bl-double">
              按贷款期限划分合计
            </td>
            <td class="report-gray">{{ reportDetail.loanTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.in_gua_total }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.in_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.in_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.un_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.un_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.comps_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.loanTotal.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loanTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loanTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="4" class="font-weight-bold report-gray bl-double">按贷款期限划分</td>
            <td colspan="2" class="report-gray">6个月以下</td>
            <td>{{ reportDetail.loan_6.in_gua_funds }}</td>
            <td>{{ reportDetail.loan_6.in_gua_total }}</td>
            <td>{{ reportDetail.loan_6.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_6.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_6.comps_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loan_6.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loan_6.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">6（含）-12个月（含）</td>
            <td>{{ reportDetail.loan_12.in_gua_funds }}</td>
            <td>{{ reportDetail.loan_12.in_gua_total }}</td>
            <td>{{ reportDetail.loan_12.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_12.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_12.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_12.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_12.comps_funds_current_year }}</td>
            <td>{{ reportDetail.loan_12.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loan_12.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loan_12.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">12-36个月（含）</td>
            <td>{{ reportDetail.loan_36.in_gua_funds }}</td>
            <td>{{ reportDetail.loan_36.in_gua_total }}</td>
            <td>{{ reportDetail.loan_36.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_36.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_36.comps_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loan_36.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loan_36.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">36个月以上</td>
            <td>{{ reportDetail.loan_36_above.in_gua_funds }}</td>
            <td>{{ reportDetail.loan_36_above.in_gua_total }}</td>
            <td>{{ reportDetail.loan_36_above.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36_above.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_36_above.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36_above.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_36_above.comps_funds_current_year }}</td>
            <td>{{ reportDetail.loan_36_above.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loan_36_above.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loan_36_above.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="3" class="font-weight-bold report-gray report-text-lg bl-double">
              本年新增实际担保期限6个月以上的项目
            </td>
            <td>{{ reportDetail.loan_6_above.in_gua_funds }}</td>
            <td>{{ reportDetail.loan_6_above.in_gua_total }}</td>
            <td>{{ reportDetail.loan_6_above.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6_above.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_6_above.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6_above.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.loan_6_above.comps_funds_current_year }}</td>
            <td>{{ reportDetail.loan_6_above.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.loan_6_above.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.loan_6_above.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="3" class="font-weight-bold report-gray bl-double">
              按支持经营主体类型划分合计
            </td>
            <td class="report-gray">{{ reportDetail.classTotal.in_gua_funds }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.in_gua_total }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.in_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.in_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.un_gua_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.un_gua_total_current_year }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.comps_funds_current_year }}</td>
            <td class="report-gray">{{ reportDetail.classTotal.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.classTotal.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.classTotal.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td rowspan="4" class="font-weight-bold report-gray bl-double">
              按支持经营主体类型划分
            </td>
            <td colspan="2" class="report-gray">家庭农场（种养大户）</td>
            <td>{{ reportDetail.class_org_farm.in_gua_funds }}</td>
            <td>{{ reportDetail.class_org_farm.in_gua_total }}</td>
            <td>{{ reportDetail.class_org_farm.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_org_farm.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_org_farm.comps_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.class_org_farm.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.class_org_farm.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">家庭农场</td>
            <td>{{ reportDetail.class_org_farm_family.in_gua_funds }}</td>
            <td>{{ reportDetail.class_org_farm_family.in_gua_total }}</td>
            <td>{{ reportDetail.class_org_farm_family.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm_family.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_org_farm_family.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm_family.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_org_farm_family.comps_funds_current_year }}</td>
            <td>{{ reportDetail.class_org_farm_family.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.class_org_farm_family.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.class_org_farm_family.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农民专业合作社</td>
            <td>{{ reportDetail.class_cooperate.in_gua_funds }}</td>
            <td>{{ reportDetail.class_cooperate.in_gua_total }}</td>
            <td>{{ reportDetail.class_cooperate.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_cooperate.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_cooperate.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_cooperate.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_cooperate.comps_funds_current_year }}</td>
            <td>{{ reportDetail.class_cooperate.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.class_cooperate.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.class_cooperate.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td colspan="2" class="report-gray">农业企业</td>
            <td>{{ reportDetail.class_enterprise.in_gua_funds }}</td>
            <td>{{ reportDetail.class_enterprise.in_gua_total }}</td>
            <td>{{ reportDetail.class_enterprise.in_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_enterprise.in_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_enterprise.un_gua_funds_current_year }}</td>
            <td>{{ reportDetail.class_enterprise.un_gua_total_current_year }}</td>
            <td>{{ reportDetail.class_enterprise.comps_funds_current_year }}</td>
            <td>{{ reportDetail.class_enterprise.comps_total_current_year }}</td>
            <td class="report-gray">
              {{ reportDetail.class_enterprise.in_gua_funds_current_month }}
            </td>
            <td class="report-gray br-double">
              {{ reportDetail.class_enterprise.in_gua_total_current_month }}
            </td>
          </tr>
          <tr>
            <td class="font-weight-bold report-gray bl-double bb-double bt-double">备注</td>
            <td colspan="12" class="bb-double bt-double br-double"></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="text-center pt-2" v-if="!isViewMode">
      <el-button type="primary" class="btn-long" :loading="submitLoading" @click="submit">
        保存
      </el-button>
      <el-button class="btn-long" @click="onClose">取消</el-button>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { add, sub, excelTableExport, domHasClass } from '@vimi/utils-tool'
import { buttonEdit } from '@/credit/views/city/report/Manage'
const postKeys = [
  'policy_bus_cur',
  'policy_bus_other',
  'policy_bus_1000_cur',
  'policy_bus_1000_other',
  'policy_control_10',
  'policy_control_1000',
  'policy_control_ex_1000',
  'policy_control_ex_other',
  'ind_foods',
  'ind_features',
  'ind_pig',
  'ind_animal_other',
  'ind_fish',
  'ind_farmland',
  'ind_service',
  'ind_circulation',
  'ind_process',
  'ind_new_forms',
  'ind_other',
  'loan_6',
  'loan_12',
  'loan_36',
  'loan_36_above',
  'loan_6_above',
  'class_org_farm',
  'class_org_farm_family',
  'class_cooperate',
  'class_enterprise',
]
export default {
  components: {},
  props: {
    editMode: { type: Boolean, default: false },
  },
  data() {
    return {
      loading: false,
      downloadLoading: false,
      params: {
        index: 1,
        size: 1,
        subKey: 'report_month_detail.report_month_id',
        'report_type.eq': 1,
      },
      order: {
        year_number: 'desc',
        month_number: 'desc',
      },
      tableName: 'report_month',
      report: {},
      riskData: {},
      orgUserData: {},
      assetsBerfData: {},
      assetsData: {},
      reportData: [],
      reportDetail: {
        policy_bus_cur: {},
        policy_bus_other: {},
        policy_bus_1000_cur: {},
        policy_bus_1000_other: {},
        policy_control_10: {},
        policy_control_1000: {},
        policy_control_ex_1000: {},
        policy_control_ex_other: {},
        ind_foods: {},
        ind_features: {},
        ind_pig: {},
        ind_animal_other: {},
        ind_fish: {},
        ind_farmland: {},
        ind_service: {},
        ind_circulation: {},
        ind_process: {},
        ind_new_forms: {},
        ind_other: {},
        loan_6: {},
        loan_12: {},
        loan_36: {},
        loan_36_above: {},
        loan_6_above: {},
        class_org_farm: {},
        class_org_farm_family: {},
        class_cooperate: {},
        class_enterprise: {},
        policyTotal: {},
        policyBusTotal: {},
        policyBus1000Total: {},
        policyControlTotal: {},
        policyControlExTotal: {},
        indTotal: {},
        loanTotal: {},
        classTotal: {},
      },
      validatorAll: {},
      columnsKey: [
        'in_gua_funds',
        'in_gua_total',
        'in_gua_funds_current_year',
        'in_gua_total_current_year',
        'un_gua_funds_current_year',
        'un_gua_total_current_year',
        'comps_funds_current_year',
        'comps_total_current_year',
        'in_gua_funds_current_month',
        'in_gua_total_current_month',
      ],

      isPost: false,
      submitLoading: false,
      industryData: {},
      orgClassData: {},
      periodData: {},
      policyCount: {}, // 上个月按政策性划分合计
      policyData: {},
      isEdit: false,
    }
  },
  computed: {
    ...mapGetters(['clientId', 'org', 'user']),
    buttonEdit() {
      const button = +this.reportMonth === +new Date().getMonth() && !this.isPost
      return buttonEdit() && button && +this.user.isReporter === 1
    },
    compsRate() {
      const number1 = this.reportDetail.policyTotal.comps_funds_current_year || 0
      const number2 = this.reportDetail.policyTotal.un_gua_funds_current_year || 1
      return Math.round((number1 / number2) * 10000) / 100
    },
    recoveryRate() {
      const number1 = this.reportDetail.policyTotal.comps_funds_current_year || 0
      const subnum = this.riskData.current_year_recover_funds || 0
      const number2 = this.reportDetail.policyTotal.un_gua_funds_current_year || 1
      return Math.round((sub(number1 - subnum) / number2) * 10000) / 100
    },
    compsTotalRate() {
      const number1 = this.riskData.comps_funds || 0
      const number2 = this.riskData.un_gua_funds || 1
      return Math.round((number1 / number2) * 10000) / 100
    },
    recoveryMonthRate() {
      const number1 = this.riskData.in_gua_onverdue_funds || 0
      const number2 = this.reportDetail.policyTotal.in_gua_funds || 1
      return Math.round((number1 / number2) * 10000) / 100
    },
    comperPerson() {
      return add(this.orgUserData.full_time_person, this.orgUserData.sub_full_time_person)
    },
    haveFullAgency() {
      const agency = add(this.orgUserData.full_time_agency, this.orgUserData.bel_full_time_agency)
      if (agency > this.orgUserData.sub_full_time_person) {
        return '有专职人员机构数应小于等于分支机构专职人员数'
      } else {
        return agency
      }
    },
    ishaveFullAgency() {
      const agency = add(
        this.orgUserData.branch_full_agency,
        this.orgUserData.sub_full_agency,
        this.orgUserData.office_full_agency,
        this.orgUserData.other_full_agency
      )
      if (agency === this.haveFullAgency) {
        return agency
      } else {
        return '有专职人员机构总数不等'
      }
    },
    riskFundsTotal() {
      return add(
        this.assetsData.end_term_ready,
        this.assetsData.normal_ready,
        this.assetsData.gua_comps_ready
      )
    },
    inFundsTotal() {
      return add(
        this.assetsData.other_income,
        this.assetsData.capital_invest_income,
        this.assetsData.gua_fee_income
      )
    },
    rateTotal() {
      return add(this.report.avg_loan_rate, this.report.avg_gua_rate)
    },
    // 放大倍数
    inGuaMultiple() {
      const num = add(this.assetsData.last_assets, this.assetsData.current_assets) || 0
      const subnum = sub(num, this.assetsData.stock_contry * 2) || 1
      const funds = this.reportDetail.policyTotal.in_gua_funds || 0
      return Math.round(((funds * 10000) / (subnum / 2)) * 100) / 100
    },
    newGuaMultiple() {
      const num = add(this.assetsData.last_assets, this.assetsData.current_assets) || 0
      const subnum = sub(num, this.assetsData.stock_contry * 2) || 1
      const funds = this.reportDetail.loan_6_above.in_gua_funds_current_year || 0
      return Math.round(((funds * 10000) / (subnum / 2)) * 100) / 100
    },
    isViewMode() {
      if (this.editMode) {
        return false
      } else {
        return !this.isEdit
      }
    },
    reportMonth() {
      const month = this.report.month_number || this.params['month_number.eq'] || ''
      return this.isViewMode ? month : this.params['month_number.eq']
    },
    tdClass() {
      return this.isViewMode ? '' : 'input-td'
    },
  },
  watch: {},
  created() {
    this.params['service_id.eq'] = this.clientId
    this.getData()
  },
  mounted() {},
  methods: {
    sub,
    handleEdit() {
      const queryDate = new Date()
      this.params['year_number.eq'] = queryDate.getFullYear()
      this.params['month_number.eq'] = queryDate.getMonth()
      this.isEdit = !this.isEdit
    },
    submit() {
      const report = {
        month_number: this.reportMonth,
        year_number: new Date().getFullYear(),
        submit_person_name: this.user.realName,
        in_gua_multiple: this.inGuaMultiple,
        new_gua_multiple: this.newGuaMultiple,
        avg_gua_rate: this.report.avg_gua_rate,
        avg_loan_rate: this.report.avg_loan_rate,
        service_id: this.clientId,
        phone_number: this.user.phoneNumber,
        dept_name: this.user.deptName,
      }
      const assetsData = this.getPostData(this.assetsData, [
        'capital_invest_income',
        'current_assets',
        'end_term_ready',
        'final_funds',
        'foods_funds',
        'gua_comps_ready',
        'gua_fee_income',
        'last_assets',
        'normal_ready',
        'other_income',
        'register_funds',
        'stock_contry',
      ])
      const riskData = this.getPostData(this.riskData, [
        'comps_funds',
        'comps_left_funds',
        'comps_left_total',
        'comps_total',
        'current_month_comps_funds',
        'current_month_comps_total',
        'current_year_recover_funds',
        'current_year_recover_total',
        'in_gua_onverdue_funds',
        'in_gua_onverdue_total',
        'month_overdue_no_comps_funds',
        'month_overdue_no_comps_total',
        'overdue_no_comps_funds',
        'overdue_no_comps_total',
        'recover_funds',
        'recover_total',
        'un_gua_funds',
        'un_gua_total',
      ])
      const orgUserData = this.getPostData(this.orgUserData, [
        'bel_full_time_agency',
        'bel_no_full_time_agency',
        'branch_full_agency',
        'branch_no_full_agency',
        'full_time_agency',
        'full_time_person',
        'no_full_time_agency',
        'office_full_agency',
        'office_no_full_agency',
        'other_full_agency',
        'other_no_full_agency',
        'part_time_person',
        'sub_full_agency',
        'sub_full_time_person',
        'sub_no_full_agency',
        'sub_part_time_person',
      ])
      const slaveData = []
      postKeys.forEach(key => {
        const keyArry = [
          'comps_funds_current_year',
          'comps_total_current_year',
          'in_gua_funds',
          'in_gua_funds_current_month',
          'in_gua_funds_current_year',
          'in_gua_total',
          'in_gua_total_current_month',
          'in_gua_total_current_year',
          'submit_person',
          'un_gua_funds_current_year',
          'un_gua_total_current_year',
        ]
        if (!this.isPost) {
          keyArry.push('report_month_id', 'id')
        }
        const item = this.getPostData(this.reportDetail[key], keyArry)
        item.dimension_key = key
        slaveData.push(item)
      })
      if (this.isPost) {
        this.postRepotData(report, assetsData, orgUserData, slaveData, riskData)
      } else {
        this.putRepotData(
          report,
          assetsData,
          orgUserData,
          slaveData,
          riskData,
          this.report.report_month_id
        )
      }
    },

    putRepotData(report, assetsData, orgUserData, slaveData, riskData, id) {
      if (!id) {
        return
      }
      const service = this.$serviceName
      report.report_month_id = id
      const formData = {
        masterTableInfo: JSON.stringify(report),
        masterTableName: this.tableName,
        slaveTableInfo: JSON.stringify(slaveData),
        slaveTableName: 'report_month_detail',
      }
      this.submitLoading = true
      Promise.all([
        this.$api.relatedUpdate(this.$serviceName, formData),
        this.submitAssets(service, assetsData, id),
        this.submitOrgUser(service, orgUserData, id),
        this.submitRisk(service, riskData, id),
      ])
        .then(() => {
          this.$message.success('添加成功')
          this.$emit('success', true)
          this.getData()
          this.onClose()
        })
        .finally(() => {
          this.submitLoading = false
        })
    },
    postRepotData(report, assetsData, orgUserData, slaveData, riskData) {
      this.submitLoading = true
      const service = this.$serviceName
      this.$api.addData(service, this.tableName, report).then(res => {
        const id = res.data
        if (!id) {
          return
        }
        slaveData.map(item => {
          item.report_month_id = id
          return item
        })
        Promise.all([
          this.submitAssets(service, assetsData, id),
          this.submitOrgUser(service, orgUserData, id),
          this.submitRisk(service, riskData, id),
          this.$api.addBatch(service, 'report_month_detail', slaveData),
        ])
          .then(() => {
            this.$message.success('添加成功')
            this.getData()
            this.$emit('success', true)
            this.onClose()
          })
          .finally(() => {
            this.submitLoading = false
          })
      })
    },
    submitAssets(service, assetsData, id) {
      assetsData.report_month_id = id
      if (this.assetsData.report_month_assets_liab_id && id) {
        return this.$api.updateData(
          service,
          'report_month_assets_liab',
          this.assetsData.report_month_assets_liab_id,
          assetsData
        )
      } else {
        return this.$api.addData(service, 'report_month_assets_liab', assetsData)
      }
    },
    submitOrgUser(service, orgUserData, id) {
      orgUserData.report_month_id = id
      if (this.orgUserData.report_month_agency_info_id && id) {
        return this.$api.updateData(
          service,
          'report_month_agency_info',
          this.orgUserData.report_month_agency_info_id,
          orgUserData
        )
      } else {
        return this.$api.addData(service, 'report_month_agency_info', orgUserData)
      }
    },
    submitRisk(service, riskData, id) {
      riskData.report_month_id = id
      if (this.riskData.report_month_risk_id && id) {
        return this.$api.updateData(
          service,
          'report_month_risk',
          this.riskData.report_month_risk_id,
          riskData
        )
      } else {
        return this.$api.addData(service, 'report_month_risk', riskData)
      }
    },
    getPostData(data, keys) {
      const object = {}
      keys.forEach(key => {
        object[key] = data[key]
      })
      return object
    },
    checkValidator() {
      const policyTotal = this.reportDetail.policyTotal
      const indTotal = this.reportDetail.indTotal
      const loanTotal = this.reportDetail.loanTotal
      const classTotal = this.reportDetail.classTotal
      this.validatorAll = {}
      this.columnsKey.forEach(key => {
        if (
          policyTotal[key] === indTotal[key] &&
          policyTotal[key] === loanTotal[key] &&
          policyTotal[key] === classTotal[key]
        ) {
          this.validatorAll[key] = true
        } else {
          this.validatorAll[key] = false
        }
      })
    },
    getData(params = {}) {
      if (this.editMode) {
        const queryDate = new Date()
        this.params['year_number.eq'] = queryDate.getFullYear()
        this.params['month_number.eq'] = queryDate.getMonth()
      }
      this.params = {
        ...this.params,
        ...params,
      }
      this.loading = true
      this.isPost = false
      Object.keys(this.reportDetail).forEach(key => {
        this.reportDetail[key] = {}
      })
      this.$api
        .getData(this.$serviceName, this.tableName, this.params, this.order)
        .then(res => {
          const data = (res && res.data && res.data.data) || []
          if (!data.length && !this.isViewMode) {
            this.isPost = true
            this.getRealData()
          } else {
            const detail = (data && data[0]) || {}
            this.reportData = detail.report_month_detail || []
            this.report = detail
            this.getReportRisk(detail.report_month_id)
            this.getOrgUser(detail.report_month_id)
            this.getAssets(detail.report_month_id)
            this.dataProcess(this.reportData)
            this.countValue()
            this.checkValidator()
          }
        })
        .finally(() => {
          this.loading = false
          const button = +this.reportMonth === +new Date().getMonth() && !this.isPost
          this.$emit('ispost', !button)
        })
    },
    getRealData() {
      const params = {
        index: 1,
        size: 1,
        'service_id.eq': this.clientId,
        'report_type.eq': 1,
        subKey: 'report_month_detail.report_month_id',
      }
      this.loading = true
      Object.keys(this.reportDetail).forEach(key => {
        this.reportDetail[key] = {}
      })
      this.$api
        .getData(this.$serviceName, this.tableName, params, this.order)
        .then(res => {
          const data = (res && res.data && res.data.data) || []
          const detail = (data && data[0]) || {}
          this.reportData = detail.report_month_detail || []
          this.report = detail
          this.getNewMonthData()
          this.getReportRisk(detail.report_month_id)
          this.getOrgUser(detail.report_month_id)
          this.getAssets(detail.report_month_id)
        })
        .finally(() => {
          this.loading = false
        })
    },
    getNewMonthData() {
      this.submitLoading = true
      Promise.all([
        this.get12bigdata(),
        this.getOrgClassData(),
        this.getPeriod(),
        this.getPolicyData(),
        this.getLoanRate(),
      ])
        .catch(() => {
          this.$message.error('请求失败，请刷新后重试！！')
        })
        .finally(() => {
          this.dataProcess(this.reportData)
          // 保留J25以做计算
          this.policyCount = this.getCountColumn([
            'policy_bus_cur',
            'policy_bus_other',
            'policy_bus_1000_cur',
            'policy_bus_1000_other',
            'policy_control_10',
            'policy_control_1000',
            'policy_control_ex_1000',
            'policy_control_ex_other',
          ])
          // 清空本月新增
          Object.keys(this.reportDetail).forEach(item => {
            const obj = this.reportDetail[item] || {}
            obj.in_gua_total_current_month = 0
            obj.in_gua_funds_current_month = 0
            this.reportDetail[item] = obj
          })

          this.addMonthData(this.industryData)
          this.addMonthData(this.orgClassData)
          this.addMonthData(this.periodData)
          this.addMonthData(this.policyData)
          this.countValue()
          this.checkValidator()
          this.submitLoading = false
        })
    },
    getLoanRate() {
      if (!this.isPost) {
        return
      }
      const params = {
        'service_id.eq': this.clientId,
        isBIQuery: 1,
      }
      this.$api.getData(this.$serviceName, 'report_month_rate_view', params).then(res => {
        const data = (res && res.data && res.data[0]) || {}
        this.report.avg_loan_rate =
          Math.round((data.load_rate_value_total / data.load_rate_count_total) * 100) / 100
        this.report.avg_gua_rate =
          Math.round((data.warranty_rate_value_total / data.warranty_rate_count_total) * 100) / 100
      })
    },
    getPolicyData() {
      const tableName = 'report_analysis_funds_month_view'
      const params = {
        'service_id.eq': this.clientId,
        isBIQuery: 1,
      }
      return this.fetchData(tableName, params).then(res => {
        const data = (res.data && res.data[0]) || {}
        this.setPolicyData(data)
      })
    },
    setPolicyData(data) {
      this.policyData = {
        policy_bus_cur: {
          comps_funds_current_year: data.current_month_300_new_and_on_comps_funds,
          comps_total_current_year: data.current_month_300_new_and_on_comps_total,
          current_month_new_total: data.current_month_300_new_and_on_total,
          current_month_new_funds: data.current_month_300_new_and_on_funds,
          current_month_new_un_total: data.current_month_300_new_and_un_total,
          current_month_new_un_funds: data.current_month_300_new_and_un_funds,
        },
        policy_bus_other: {
          comps_funds_current_year: data.current_month_300_new_comps_funds,
          comps_total_current_year: data.current_month_300_new_comps_total,
          current_month_new_total: data.current_month_300_new_total,
          current_month_new_funds: data.current_month_300_new_funds,
          current_month_new_un_total: data.current_month_300_new_un_total,
          current_month_new_un_funds: data.current_month_300_new_un_funds,
        },
        policy_bus_1000_cur: {
          comps_funds_current_year: data.current_month_1000_new_and_on_pig_comps_funds,
          comps_total_current_year: data.current_month_1000_new_and_on_pig_comps_total,
          current_month_new_total: data.current_month_1000_new_and_on_pig_total,
          current_month_new_funds: data.current_month_1000_new_and_on_pig_funds,
          current_month_new_un_total: data.current_month_1000_new_and_un_pig_total,
          current_month_new_un_funds: data.current_month_1000_new_and_un_pig_funds,
        },
        policy_bus_1000_other: {
          comps_funds_current_year: data.current_month_1000_new_pig_comps_funds,
          comps_total_current_year: data.current_month_1000_new_pig_comps_total,
          current_month_new_total: data.current_month_1000_new_pig_total,
          current_month_new_funds: data.current_month_1000_new_pig_funds,
          current_month_new_un_total: data.current_month_1000_new_un_pig_total,
          current_month_new_un_funds: data.current_month_1000_new_un_pig_funds,
        },
        policy_control_10: {
          comps_funds_current_year: data.comps_10_funds,
          comps_total_current_year: data.comps_10_total,
          current_month_new_total: data.current_month_10_new_total,
          current_month_new_funds: data.current_month_10_new_funds,
          current_month_new_un_total: data.current_month_10_new_un_total,
          current_month_new_un_funds: data.current_month_10_new_un_funds,
        },
        policy_control_1000: {
          comps_funds_current_year: data.current_month_1000_new_comps_funds,
          comps_total_current_year: data.current_month_1000_new_comps_total,
          current_month_new_total: data.current_month_1000_new_total,
          current_month_new_funds: data.current_month_1000_new_funds,
          current_month_new_un_total: data.current_month_1000_new_un_total,
          current_month_new_un_funds: data.current_month_1000_new_un_funds,
        },
        policy_control_ex_1000: {
          comps_funds_current_year: data.current_month_1000_above_new_comps_funds,
          comps_total_current_year: data.current_month_1000_above_new_comps_total,
          current_month_new_total: data.current_month_1000_above_new_total,
          current_month_new_funds: data.current_month_1000_above_new_funds,
          current_month_new_un_total: data.current_month_1000_above_new_un_total,
          current_month_new_un_funds: data.current_month_1000_above_new_un_funds,
        },
      }
    },
    addMonthData(data) {
      Object.keys(data).forEach(item => {
        let addItem = data[item] || {}
        let reportItem = this.reportDetail[item] || {}
        let newItem = {}

        newItem['in_gua_total'] = add(reportItem['in_gua_total'], addItem.current_month_new_total)
        newItem['in_gua_funds'] = add(reportItem['in_gua_funds'], addItem.current_month_new_funds)

        if (+this.reportMonth === 1) {
          newItem['comps_funds_current_year'] = addItem.comps_funds_current_year
          newItem['comps_total_current_year'] = addItem.comps_total_current_year
          newItem['in_gua_total_current_year'] = addItem.current_month_new_total
          newItem['in_gua_funds_current_year'] = addItem.current_month_new_funds
          newItem['un_gua_funds_current_year'] = addItem.current_month_new_un_funds
          newItem['un_gua_total_current_year'] = addItem.current_month_new_un_total
        } else {
          newItem['in_gua_total_current_year'] = add(
            reportItem['in_gua_total_current_year'],
            addItem.current_month_new_total
          )
          newItem['in_gua_funds_current_year'] = add(
            reportItem['in_gua_funds_current_year'],
            addItem.current_month_new_funds
          )

          newItem['un_gua_funds_current_year'] = add(
            reportItem['un_gua_funds_current_year'],
            addItem['current_month_new_un_funds']
          )
          newItem['un_gua_total_current_year'] = add(
            reportItem['un_gua_total_current_year'],
            addItem['current_month_new_un_total']
          )

          newItem['comps_funds_current_year'] = add(
            reportItem['comps_funds_current_year'],
            addItem['comps_funds_current_year']
          )
          newItem['comps_total_current_year'] = add(
            reportItem['comps_total_current_year'],
            addItem['comps_total_current_year']
          )
        }

        newItem['in_gua_total'] = sub(
          newItem['in_gua_total'],
          addItem['current_month_new_un_total']
        )
        newItem['in_gua_funds'] = sub(
          newItem['in_gua_funds'],
          addItem['current_month_new_un_funds']
        )

        newItem.in_gua_total_current_month = addItem.current_month_new_total
        newItem.in_gua_funds_current_month = addItem.current_month_new_funds
        this.reportDetail[item] = newItem
      })
    },
    getAssets(id) {
      this.assetsData = {}
      const tableName = 'report_month_assets_liab'
      const params = {
        'report_month_id.eq': id,
      }
      this.fetchData(tableName, params).then(res => {
        const data = res.data || []
        this.assetsData = data[0] || {}
        this.assetsBerfData = { ...this.assetsData }
      })
    },
    getOrgUser(id) {
      this.orgUserData = {}
      const tableName = 'report_month_agency_info'
      const params = {
        'report_month_id.eq': id,
      }
      this.fetchData(tableName, params).then(res => {
        const data = res.data || []
        this.orgUserData = data[0] || {}
      })
    },
    getReportRisk(id) {
      this.riskData = {}
      const tableName = 'report_month_risk'
      const params = {
        'report_month_id.eq': id,
      }
      this.fetchData(tableName, params).then(res => {
        const data = res.data || []
        this.riskData = data[0] || {}
      })
    },
    getOrgClassData() {
      const tableName = 'report_analysis_org_class_month_view'
      const sumKey = [
        'current_month_new_funds',
        'current_month_new_total',
        'current_month_new_un_total',
        'current_month_new_un_funds',
        'comps_total',
        'comps_funds',
      ]
      const sumArry = sumKey.reduce((p, c) => {
        p.push(`sum(${c})`)
        return p
      }, [])
      const params = {
        'service_id.eq': this.clientId,
        groupFunc: sumArry.join(','),
        groupFields: ['org_class_name'],
        fields: ['org_class_name'],
        isBIQuery: 1,
      }
      return this.fetchData(tableName, params).then(res => {
        const data = res.data || []
        this.setNewReportOrg(data)
      })
    },
    setNewReportOrg(data) {
      const enumOrg = {
        '家庭农场（种养大户）': 'class_org_farm',
        农民专业合作社: 'class_cooperate',
        农业企业: 'class_enterprise',
        家庭农场: 'class_org_farm_family',
      }
      data.forEach(item => {
        let newItem = {
          current_month_new_funds: item.p || 0,
          current_month_new_total: item.p1 || 0,
          current_month_new_un_total: item.p2 || 0,
          current_month_new_un_funds: item.p3 || 0,
          comps_total_current_year: item.p4,
          comps_funds_current_year: item.p5,
        }
        const idTokey = enumOrg[item.org_class_name]
        if (idTokey) {
          this.orgClassData[idTokey] = newItem
        }
      })
    },
    getPeriod() {
      const tableName = 'report_analysis_period_month_view'
      const params = {
        isBIQuery: 1,
        'service_id.eq': this.clientId,
      }
      return this.fetchData(tableName, params).then(res => {
        const data = (res.data && res.data[0]) || {}
        this.setPeriodData(data)
      })
    },
    setPeriodData(data) {
      this.periodData = {
        loan_6: {
          comps_funds_current_year: data.comps_6_funds,
          comps_total_current_year: data.comps_6_total,
          current_month_new_total: data.current_month_new_6_total,
          current_month_new_funds: data.current_month_new_6_funds,
          current_month_new_un_total: data.current_month_new_un_6_total,
          current_month_new_un_funds: data.current_month_new_un_6_funds,
        },
        loan_12: {
          comps_funds_current_year: data.comps_12_funds,
          comps_total_current_year: data.comps_12_total,
          current_month_new_total: data.current_month_new_12_total,
          current_month_new_funds: data.current_month_new_12_funds,
          current_month_new_un_total: data.current_month_new_un_12_total,
          current_month_new_un_funds: data.current_month_new_un_12_funds,
        },
        loan_36: {
          comps_funds_current_year: data.comps_36_funds,
          comps_total_current_year: data.comps_36_total,
          current_month_new_total: data.current_month_new_36_total,
          current_month_new_funds: data.current_month_new_36_funds,
          current_month_new_un_total: data.current_month_new_un_36_total,
          current_month_new_un_funds: data.current_month_new_un_36_funds,
        },
        loan_36_above: {
          comps_funds_current_year: data.comps_36above_funds,
          comps_total_current_year: data.comps_36above_total,
          current_month_new_total: data.current_month_new_36_above_total,
          current_month_new_funds: data.current_month_new_36_above_funds,
          current_month_new_un_total: data.current_month_new_un_36_above_total,
          current_month_new_un_funds: data.current_month_new_un_36_above_funds,
        },
        loan_6_above: {
          comps_funds_current_year: data.current_month_new_6above_comps_funds,
          comps_total_current_year: data.current_month_new_6above_comps_total,
          current_month_new_total: data.current_month_new_6_total,
          current_month_new_funds: data.current_month_new_6_funds,
          current_month_new_un_total: data.current_month_new_un_6above_total,
          current_month_new_un_funds: data.current_month_new_un_6above_funds,
        },
      }
    },
    fetchData(tableName, params) {
      return this.$api.getData(this.$serviceName, tableName, params)
    },
    get12bigdata() {
      const tableName = 'report_analysis_main_business_month_view'
      const params = {
        'service_id.eq': this.clientId,
        isBIQuery: 1,
        'main_business_type.eq': 2,
      }
      return this.fetchData(tableName, params).then(res => {
        const data = res.data || []
        this.setIndustryData(data)
      })
    },
    setIndustryData(data) {
      const enumInd = {
        15: 'ind_foods', // 粮食种植
        16: 'ind_features', // 重要特色农产品
        17: 'ind_animal_other', // 其他畜牧业
        18: 'ind_pig', // 生猪养殖
        19: 'ind_fish', // 渔业生产
        20: 'ind_farmland', // 农田基础设施
        21: 'ind_service', // 农资、农机、农技等农业社会化服务
        22: 'ind_circulation', // 农产品流通
        23: 'ind_process', // 农产品初加工
        24: 'ind_new_forms', // 农业新业态
      }
      data.forEach(item => {
        let newItem = {
          comps_funds_current_year: item.comps_funds,
          comps_total_current_year: item.comps_total,
          current_month_new_funds: item.current_month_new_funds || 0,
          current_month_new_total: item.current_month_new_total || 0,
          current_month_new_un_total: item.current_month_new_un_total || 0,
          current_month_new_un_funds: item.current_month_new_un_funds || 0,
        }
        const idTokey = enumInd[item.main_business_id]
        if (idTokey) {
          this.industryData[idTokey] = newItem
        }
      })
    },
    dataProcess(reportData) {
      reportData.forEach(item => {
        let newItem = {}
        Object.keys(item).forEach(key => {
          if (this.columnsKey.includes(key)) {
            newItem[key] = +item[key] || 0
          } else {
            newItem[key] = item[key] || ''
          }
        })
        this.reportDetail[item.dimension_key] = newItem
      })
    },
    countValue() {
      this.reportDetail.policyTotal = this.getCountColumn([
        'policy_bus_cur',
        'policy_bus_other',
        'policy_bus_1000_cur',
        'policy_bus_1000_other',
        'policy_control_10',
        'policy_control_1000',
        'policy_control_ex_1000',
        'policy_control_ex_other',
      ])
      this.reportDetail.policyBusTotal = this.getCountColumn(['policy_bus_cur', 'policy_bus_other'])
      this.reportDetail.policyBus1000Total = this.getCountColumn([
        'policy_bus_1000_cur',
        'policy_bus_1000_other',
      ])
      this.reportDetail.policyControlTotal = this.getCountColumn([
        'policy_control_10',
        'policy_control_1000',
      ])
      this.reportDetail.policyControlExTotal = this.getCountColumn([
        'policy_control_ex_1000',
        'policy_control_ex_other',
      ])
      this.reportDetail.indTotal = this.getCountColumn([
        'policy_control_ex_other',
        'ind_foods',
        'ind_features',
        'ind_pig',
        'ind_animal_other',
        'ind_fish',
        'ind_farmland',
        'ind_service',
        'ind_circulation',
        'ind_process',
        'ind_new_forms',
        'ind_other',
      ])
      this.reportDetail.loanTotal = this.getCountColumn([
        'loan_6',
        'loan_12',
        'loan_36',
        'loan_36_above',
      ])
      this.reportDetail.classTotal = this.getCountColumn([
        'class_org_farm',
        'class_enterprise',
        'class_org_farm_family',
        'class_cooperate',
      ])
    },
    getCountColumn(arr) {
      const object = {}
      this.columnsKey.forEach(key => {
        object[key] = this.countColumn(arr, key)
      })
      return object
    },
    countColumn(columns, key) {
      let sum = 0
      let row = {}
      columns.forEach(item => {
        row = this.reportDetail[item] || {}
        sum = add(sum, row[key])
      })
      return sum
    },

    onExportExcel() {
      const borderAllThin = {
        left: { style: 'thin' },
        top: { style: 'thin' },
        right: { style: 'thin' },
        bottom: { style: 'thin' },
      }
      const cellStyles = {}
      for (let i = 0; i < 13; i++) {
        cellStyles[`0-${i}`] = { font: { bold: true }, border: borderAllThin }
        cellStyles[`1-${i}`] = { font: { bold: true }, border: borderAllThin }
      }
      cellStyles['0-0'].font.sz = 24
      cellStyles['0-0'].font.name = '方正小标宋简体'

      // 中间空行
      for (let i = 0; i < 13; i++) {
        cellStyles[`${String.fromCharCode(i + 65)}22`] = {
          border: {
            left: { style: 'none' },
            right: { right: 'none' },
          },
        }
      }

      this.downloadLoading = true
      return excelTableExport(
        'table-print',
        `省级农担公司业务发展情况统计月报（${this.reportMonth}月）`,
        {
          styles: {
            border: borderAllThin,
            alignment: {
              vertical: 'center',
              horizontal: 'center',
              wrapText: true,
            },
            font: {
              name: '微软雅黑',
            },
          },
          cellStyles,
          cols: [
            { wch: 10.13 },
            { wch: 15.63 },
            { wch: 17.63 },
            { wch: 21.88 },
            { wch: 17.25 },
            { wch: 20.63 },
            { wch: 17.75 },
            { wch: 19.5 },
            { wch: 20.63 },
            { wch: 18.5 },
            { wch: 23.0 },
            { wch: 21.75 },
            { wch: 18.25 },
          ],
          cellHandler: ({ td, tr }) => {
            const style = {}
            if (domHasClass(tr, 'report-gray') || domHasClass(td, 'report-gray')) {
              style.fill = { fgColor: { rgb: 'FFA6A6A6' } }
            }
            if (domHasClass(tr, 'font-weight-bold') || domHasClass(td, 'font-weight-bold')) {
              style.font = { bold: true }
            }
            if (domHasClass(td, 'text-danger')) {
              if (!style.font) style.font = {}
              style.font.color = { rgb: 'FFFF0000' }
            }

            return { style }
          },
        }
      )
    },
    onClose() {
      this.isEdit = false
      this.assetsData = { ...this.assetsBerfData }
      this.$emit('close', false)
    },
  },
}
</script>

<style lang="scss" scoped>
.edit-button {
  position: absolute;
  top: 0;
  right: 0;
}
.input-td {
  background: #ffffee;
}
$report-td-border-color: #000;
.report-table {
  position: relative;
  tbody td {
    border: 1px solid $report-td-border-color;
    vertical-align: middle;
    text-align: center;
  }
}
.report-title {
  font-size: 1.5rem;
  font-family: '方正小标宋简体', 'SimSun', cursive;
  margin: 0;
  text-align: center;
}
.report-gray {
  background-color: #a6a6a6;
}
.report-text-lg {
  font-size: 1.1rem;
}
.bt-double {
  border-top-width: 2pt !important;
  border-top-style: double !important;
}
.bb-double {
  border-bottom-width: 2pt !important;
  border-bottom-style: double !important;
}
.bl-double {
  border-left-width: 2pt !important;
  border-left-style: double !important;
}
.br-double {
  border-right-width: 2pt !important;
  border-right-style: double !important;
}
.bx-none {
  border-left: none !important;
  border-right: none !important;
}
</style>
